// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/adviser/index',
    children: [
      {
        path: '/adviser',
        name: 'adviser',
        redirect: '/adviser/index',
        component: RouteView,
        meta: { title: '工作总览', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/adviser/index',
            name: 'AdviserIndex',
            component: () => import('@/views/adviser/Adviser'),
            meta: { title: '日程总览', keepAlive: true }
          },
          {
            path: '/adviser/data',
            name: 'Data',
            component: () => import('@/views/adviser/Data'),
            meta: { title: '数据中心', keepAlive: true }
          }
        ]
      },
      {
        path: '/contract',
        name: 'contract',
        redirect: '/contract/list',
        component: RouteView,
        meta: { title: '合同管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/contract/list',
            name: 'ContractList',
            component: () => import('@/views/contract/ContractList'),
            meta: { title: '合同列表', keepAlive: true }
          },
          {
            path: '/contract/refund',
            name: 'RefundList',
            component: () => import('@/views/contract/RefundList'),
            meta: { title: '退款合同', keepAlive: true }
          }
        ]
      },
      {
        path: '/business',
        name: 'business',
        redirect: '/business/list',
        component: RouteView,
        meta: { title: '业务管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/business/list',
            name: 'BusinessList',
            component: () => import('@/views/business/BusinessList'),
            meta: { title: '已开启业务', keepAlive: true }
          },
          {
            path: '/business/stop',
            name: 'StopList',
            component: () => import('@/views/business/StopList'),
            meta: { title: '已停止业务', keepAlive: true }
          }
        ]
      },
      {
        path: '/my',
        name: 'my',
        redirect: '/my/info',
        component: RouteView,
        meta: { title: '个人管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/my/info',
            name: 'PersonalInfo',
            component: () => import('@/views/my/PersonalInfo'),
            meta: { title: '个人信息', keepAlive: true }
          }
        ]
      },
      {
        path: '/msg',
        name: 'msg',
        redirect: '/msg/all',
        component: RouteView,
        meta: { title: '消息中心', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/msg/all',
            name: 'AllMessage',
            component: () => import('@/views/message/AllMessage'),
            meta: { title: '全部消息', keepAlive: true }
          }
        ]
      },
      {
        path: '/schedule',
        name: 'schedule',
        redirect: '/schedule/myschedule',
        component: RouteView,
        meta: { title: '我的排班', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/schedule/myschedule',
            name: 'MySchedule',
            component: () => import('@/views/schedule/MySchedule'),
            meta: { title: '计划日程', keepAlive: true }
          },
          {
            path: '/schedule/myexamine',
            name: 'MyExamine',
            component: () => import('@/views/schedule/MyExamine'),
            meta: { title: '作息审批', keepAlive: true }
          }
        ]
      },
      {
        path: '/other',
        name: 'other',
        redirect: '/other/change',
        component: RouteView,
        meta: { title: '其他管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/other/change',
            name: 'ChangePassword',
            component: () => import('@/views/other/ChangePassword'),
            meta: { title: '修改密码', keepAlive: true }
          }
        ]
      }
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user/login',
    name: 'UserLogin',
    hidden: true,
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login'),
    meta: { title: '用户登录' }
  },
  {
    path: '/404',
    name: 'notFound',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/404')
  },
  {
    path: '/500',
    name: 'notFound2',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/500')
  }
]
